/*
 * Copyright 2023 Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@use "sass:color";

/* XML Content Display Styles */
.configXmlContainer {
  position: relative;
  margin: 10px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* 防止容器越界 */
}

.configXmlFilePathTop {
  position: absolute;
  top: -20px;
  right: 10px;
  font-size: 12px;
  color: #666;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 10; /* 确保在最上层 */
}

.configXmlMainPanel {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* 防止面板越界 */
}

.configXmlHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
  background: #f8f8f8;
  width: 100%;
  box-sizing: border-box;
}

.configXmlInfo {
  font-size: 13px;
  color: #666;
  flex: 1;
  min-width: 0; /* 防止 flex 项目越界 */
}

.configXmlLastModified {
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.configXmlActions {
  display: flex;
  gap: 8px;
  flex-shrink: 0; /* 防止按钮被压缩 */
}

.configXmlContent {
  padding: 15px;
  overflow: auto; /* 水平和垂直滚动条 */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 400px; /* 最小高度 */
  max-height: 70vh; /* 最大高度，防止页面过长 */
}

/* 让编辑态下的 textarea 占满内容区域宽度，覆盖全局表单控件固定宽度 */
.configXmlContent textarea {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important; /* 确保不超过容器宽度 */
  display: block;
  box-sizing: border-box;
  overflow: auto; /* 水平和垂直滚动条 */
  resize: vertical; /* 只允许垂直调整大小 */
}

.configXmlPre {
  margin: 0;
  padding: 15px;
  background-color: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 70vh;
  overflow: auto; /* 水平和垂直滚动条 */
  width: 100%;
  max-width: 100%; /* 确保不超过容器宽度 */
  box-sizing: border-box;
}

.xml-tag {
  color: #800;
}

.xml-attribute {
  color: #00f;
}

.xml-value {
  color: #080;
}

.xml-comment {
  color: #888;
  font-style: italic;
}

.xml-text {
  color: #000;
}

.xml-equals {
  color: #000;
}

/* 编辑模式样式 */
.configXmlTextarea {
  width: 100% !important;
  min-width: 100%;
  max-width: 100% !important; /* 确保不超过容器宽度 */
  min-height: 500px;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.4;
  background-color: #ffc; /* 浅黄色背景表示编辑模式 */
  border: 1px solid #ccc;
  padding: 15px;
  box-sizing: border-box;
  resize: vertical;
  overflow: auto; /* 水平和垂直滚动条 */
  white-space: pre;
  word-wrap: normal;
}

/* 确保 SPA 页面整体布局不越界 */
.sub_tab_container_content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.admin-tab-contents {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
